/**
 * Created by shichunguang on 16/10/11.
 */


import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    ListView,
    Image,
    TouchableOpacity,
    Platform,
    TextInput,
    Navigator
} from 'react-native';

//Dimentsions
var Dimensions = require('Dimensions');
var Width = Dimensions.get('window').width; //屏宽
var NavigationBar = require('../Main/NXNavigationBar');
var Register = React.createClass({
    render() {
        return (
            <View style={styles.container}>
    <NavigationBar title="注册" leftBtnName='return_icon' rightBtnName='Share_icon'  leftpress={()=>this.leftBtnAction()} rightPress={()=>this.rightBtnAction()}></NavigationBar>
        <TextInput
        style={styles.inputStyleUser}
        keyboardType={'number-pad'}
        placeholder="请输入手机号"
        clearButtonMode={'always'}
        ref = 'telephone'
            >
            </TextInput>
            <TextInput
        style={styles.inputStylePassword}
        placeholder="请输入密码"
        password={true}
        ref ='passwords'
            >
            </TextInput>
            <View style={styles.loginStyle}>
    <Text style={styles.btnRegister} onPress={()=>this.registerBtnAction()}>注册</Text>
        </View>

        </View>
    );
    },
    leftBtnAction(){
        this.props.navigator.pop({

            }
        );
    },
    rightBtnAction(){
        alert('又说那话')
    },
    registerBtnAction(){
        var tel = this.refs.telephone._lastNativeText;
        var password = this.refs.passwords._lastNativeText;
        if((tel == undefined || tel.length != 11)||(password == undefined)||password.length < 6){
            alert('请检查输入的手机号或是密码是否正确')
        }else {
            this.props.navigator.pop({

            });
            //alert('欢迎使用品味APP')
        }
    }


});


var styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor:'white',

    },
    navigatorStyle:{

    },
    inputStyleUser:{
        marginTop:44,
        marginLeft:20,
        marginRight:20,
        //width:Width*3/4,
        height:44,
        borderWidth:1,
        borderRadius:6,
        borderColor:'#e8e8e8'

    },
    inputStylePassword:{
        marginTop:20,
        marginLeft:20,
        marginRight:20,
        borderRadius:6,
        //width:Width*3/4,
        height:44,
        borderWidth:1,
        borderColor:'#e8e8e8'
    },
    loginStyle:{
        marginTop:10,
        marginLeft:22,
        marginRight:22,
        height:44,
        backgroundColor:'red',
        borderRadius:6
    },
    btnRegister:{
        fontSize:20,
        textAlign:'center',
        color:'white',
        marginTop:11
    }


});

module.exports = Register;
